#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;

int n, q;
map<PII, bool> mp;


int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> q;

    int t, a, b;
    while(q --){
        cin >> t >> a >> b;
        if(t == 1){
            if(mp.count({a, b})){
                mp[{a, b}] = true;
            }else{
                mp[{a, b}] = true;
            }
        }else if(t == 2){
            if(mp.count({a, b})){
                mp[{a, b}] = false;
            }
        }else{
            if(mp.count({a, b}) && mp.count({a, b}) && mp[{a, b}] && mp[{b, a}]){
                cout << "Yes" << '\n';
            }else{
                cout << "No" << '\n';
            }
        }
    }

    return 0;
}